<?php

namespace app\shop\controller;

use Throwable;
use app\common\controller\PCBase;
use app\shop\logic\ShopLogic;
use think\facade\Db;

class Shop extends PCBase
{


    /**
     * @desc  获取店铺信息
     * @author luckyXiong
     */
    public function index()
    {

        $params = $this->request->post();
        return (new ShopLogic())->getShopsList($params);
    }


    /**
     * @desc  获取店铺信息
     * @author luckyXiong
     */
    public function edit()
    {
        if($this->request->get()){
            $param  = $this->request->get();
            $row = Db::name('shops')->find($param['id']);
            $row['user_id']  = $row['user_id'] ? explode(',',$row['user_id']):'';
            return json(DefaultResponse(200, true, '获取成功', ['row' => $row]));
        }else{
            $params  = $this->request->post();
            return (new ShopLogic())->editShopsList($params);
        }
    }




    /**
     * @desc  获取员工信息列表
     * @author luckyXiong
     */
    public function getUserList()
    {
        $params = $this->request->post();
        return (new ShopLogic())->getUserList($params);
    }




    /**
     * @desc   店铺拖放排序
     * @author luckyXiong
     */
    public function sortable()
    {
        $params = $this->request->post();
        return (new ShopLogic())->sortable($params);
    }






}
